<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>props 初体验</title>
</head>

<body>
    <div id="root"> </div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        //数据
        let data = {
            name: '可可',
            age: 18,
            gender: '女'
        }

        let hongmiao = {
            name: '宏苗',
            age: 17,
            gender: '女'
        }

        class App extends React.Component{
            render(){
                // console.log(this.props);
                let {name, gender, age} = this.props;
                return <ul>
                        <li>姓名: {name}</li>
                        <li>性别: {gender}</li>
                        <li>年龄: {age}</li>
                    </ul>
            }
        }

        //渲染
        ReactDOM.render(
            <div>
                <App name={data.name} age={data.age} gender={data.gender}  />
                <App {...hongmiao} />
            </div> , document.querySelector("#root"));
    </script>
</body>

</html>